//index.js
const util = require('../../utils/util.js')
//获取应用实例
const app = getApp()

Page({
  data: {
    imgUrls: [
      '/static/imgs/adver03.jpg',
      '/static/imgs/adver01.jpg',
      '/static/imgs/adver02.jpg',
      ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    cates:[]
  },
  onLoad:function(){

  },
  toSearchPage :function(){
    wx.navigateTo({
      url: '/pages/search/search',
    })
  },
  toListPage: function (event) {
    wx.navigateTo({
      url: '/pages/list/list?cid=' + event.currentTarget.dataset.cid,
    })
  },
  getCates:function(){
    var _this = this;
    wx.request({
      url: util.url.getCates,
      data: {id:0},
      method:"GET",
      success:function(res){
        //菜单数据
        _this.setData({
          cates:res.data
        })
      }
    })
  },
  onReady:function(){
    this.getCates();
  }
})
